//
//  FirstViewController.swift
//  VCPushTranstion
//
//  Created by 李煜 on 2024/9/13.
//

import UIKit

class FirstViewController: UIViewController, UINavigationControllerDelegate {
  override func viewDidLoad() {
    super.viewDidLoad()
    navigationController?.delegate = self
  }
  override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    super.touchesBegan(touches, with: event)
    pushNextViewController()
  }
  func pushNextViewController() {
    let nextVC = SecondViewController()
    navigationController?.pushViewController(nextVC, animated: true)
  }
  
  func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
    if operation == .push {
      return CustomPushTransition()
    }
    return nil
  }
}


